'''
name: MD Murad Hossain
Gmail: [email protected]
||||\\\ ////|||| |||| |||| ||||\\\\\\\\\ ///////// ||||\\\\\\\\
|||| \\\ //// |||| |||| |||| |||| \\\\ //// \\\\ |||| \\\\
|||| \\\ //// |||| |||| |||| |||| \\\\ //// \\\\ |||| \\\\
|||| \\\ //// |||| |||| |||| |||| \\\\ //// \\\\ |||| \\\\
|||| ===== |||| |||| |||| ||||======== //// \\\\ |||| \\\\
|||| |||| \\\\ //// |||| \\\\ ////===========\\\\ |||| \\\\
|||| |||| \\\\ //// |||| \\\\ //// \\\\ |||| \\\\
|||| |||| ============ |||| \\\\ //// \\\\ ||||/////////
'''
import sys ; input = sys.stdin.readline
for _ in range(int(input())):
n, arr= int(input()),[]
for _ in range(2): arr.append(list(map(int,input().split())))
mx = 1e15 ; sum1 = sum2 = 0
for i in range(n): sum1 += arr[0][i]
for i in range(n): sum1 -= arr[0][i] ; mx = min(mx,max(sum1,sum2)) ; sum2 += arr[1][i]
print(mx)
#include<bits/stdc++.h>
#define ld long double
#define ss second
#define ff first
#define int long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define ll long long
#define rall(x) x.rbegin(), x.rend()
#define sz(a) (int)a.size()
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define sp(x) fixed << setprecision(x)
#define ms multiset
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y);
using namespace std;
const string YES = "YES";
const string NO = "NO";
const long long MOD = 1e9 + 7;
const int N = 1e5 + 5;
const long long inf = 9e18;
const int M = 3e3 + 5;
const double EPS = 1e-6;
const ll neg = -1;
const string imp = "impossible";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll B = uniform_int_distribution<ll>(0, M - 1)(rng);
void setIO(string name = "") {
if (sz(name)) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
void boost(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
}
void solve(){
ll m; cin >> m;
ll a[2][m];
for(ll i = 0;i<2;i++){
for(ll j = 0;j<m;j++){
cin >> a[i][j];
}
}
ll pref1 = 0;
ll pref2 = 0;
for(ll i = 0;i<m;i++){
pref1+=a[0][i];
//pref2[]
}
ll res = inf;
for(ll i = 0;i<m;i++){
pref1-=a[0][i];
res =min(res,max(pref1,pref2));
pref2+=a[1][i];
}
cout << res << endl;
}
signed main(){
boost();
ll q = 1; cin >> q;
while(q--) {
solve();
}
return 0;
}
1547C - Pair Programming | 550A - Two Substrings |
797B - Odd sum | 1093A - Dice Rolling |
1360B - Honest Coach | 1399C - Boats Competition |
1609C - Complex Market Analysis | 1657E - Star MST |
1143B - Nirvana | 1285A - Mezo Playing Zoma |
919B - Perfect Number | 894A - QAQ |
1551A - Polycarp and Coins | 313A - Ilya and Bank Account |
1469A - Regular Bracket Sequence | 919C - Seat Arrangements |
1634A - Reverse and Concatenate | 1619C - Wrong Addition |
1437A - Marketing Scheme | 1473B - String LCM |
1374A - Required Remainder | 1265E - Beautiful Mirrors |
1296A - Array with Odd Sum | 1385A - Three Pairwise Maximums |
911A - Nearest Minimums | 102B - Sum of Digits |
707A - Brain's Photos | 1331B - Limericks |
305B - Continued Fractions | 1165B - Polycarp Training |